/*
 * @Author: czy
 * @Date: 2021-04-26 07:44:06
 * @LastEditTime: 2021-05-01 09:39:31
 */
#ifndef __SHELL_H_
#define __SHELL_H_

#define MAX_ARGC 10
#define NAME_SIZE 80
#define HELP_SIZE 200
#define COMMAND_SIZE 30
#define BUFFER 100
#define HISTORY_SIZE 30
#define PROMPT "czy > "

typedef struct
{
    char name[NAME_SIZE];
    char help_content[HELP_SIZE];
    int (*func)(int argc, char *argv[]);
} command;
typedef struct
{
    int current;
    int length;
    char commands[HISTORY_SIZE][BUFFER];
} historyCommand;
typedef struct
{
    char *head;
    char *tail;
    char *current;
    int output_str_len;
} instruction;

void startShell(void);
int match(char *name, command *cmd);
void addcmd(char *name, char *help_content, int (*func)(int argc, char *argv[]));
void getcmd(command *cmds, int *length);
void print_history_command(int num);
void register_command(void);

#endif